package com.xbongbong.paas.service.stage.config;

import com.xbongbong.paas.service.stage.StageHandle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Map;
import java.util.stream.Collectors;

/**
 * 策略配置
 * @author 李少杰
 * @version v1.0.0
 * @date 2021/11/22 18:02
 */
@Configuration
public class StageHandleConfig {

    @Autowired
    private Map<String, StageHandle> stageHandleMap;

    @Bean("stageHandleMap")
    public Map<Integer, StageHandle> initStageHandleMap() {
        return stageHandleMap.values().stream().collect(Collectors.toMap(StageHandle::businessType, t -> t, (t, t1) -> t1));
    }
}
